let ScoreText=require("UI_ScoreText");
cc.Class({
    extends: cc.Component,

    properties:()=>({

        score:0,

        level:1,

        ScoreText:{
            default:null,
            type:ScoreText,
        }
    }),

    RegisterUIScore(scoreText)
    {
        this.ScoreText =scoreText;

    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },
    //重置游戏
    RestGame()
    {
       this.score=0;
       this.level=1;
       //this.ScoreText.SetScore(this.score);

    },

    AddScore(sco){

        this.score+=(sco*this.level);
        this.ScoreText.SetScore(this.score);
        //console.log("当前分数是"+this.score);
    },

    ///参数为时间
    ScoreDouble(time)
    {

        this.level*=2;
        this.ScoreText.ShowDoubleText(this.level);
        this.scheduleOnce(function(){
            this.level/=2;
            if(this.level<1){
                this.level =1;
            }
            this.ScoreText.CloseDoubleText();
        },time);


    },

    // update (dt) {},
});
